package org.wechat4j.api;

import junit.framework.TestCase;
import org.junit.BeforeClass;
import org.wechat4j.api.token.AccessTokenUtils;
import org.wechat4j.exception.MpInvokeException;

/**
 * @author bjliuyong
 * @version 1.0
 * @created date 16-11-11
 */
public abstract class BaseTestCase extends TestCase {

    protected static String accessToken ;

    static {
        try {
            beforeClass();
        } catch (MpInvokeException e) {
            e.printStackTrace();
        }
    }


    public static void beforeClass() throws MpInvokeException{
        System.out.println("beforeClass init accessToken ....");
        String appID = "wxa426d214d1f916d0";
        String appsecret = "54cc26d776abdc59ec26ba3227e511f7";
        accessToken = AccessTokenUtils.getAccessToken(appID, appsecret);
        System.out.println("beforeClass inited accessToken value =>" + accessToken);
    }

    public static String getAccessToken(){
        return accessToken ;
    }
}
